package com.hup.utils.swing.view.viewTable;

import com.hup.utils.swing.customView.viewTable.TColumnInfo;
import com.hup.utils.swing.customView.viewTable.TColumnInfo.Builder;
import com.hup.utils.swing.customView.viewTable.ViewTableRowBo;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;

import java.util.ArrayList;
import java.util.Vector;

/**
 * @author hugan
 * @date 2020/3/9
 */
@Setter
@Getter
@ToString
public class SimpleRow implements ViewTableRowBo<SimpleRow> {

    private static final ArrayList<TColumnInfo> COLUMN_INFO;

    static {
        Builder builder = Builder.builder(58);
        builder.add("行", Integer.class)
                .add("组合", String.class)
                .add("行编码", String.class)
                .add("数量", Long.class)
                .add("均值", Double.class);
        COLUMN_INFO = builder.get();
    }

    public Integer row;
    public String group;
    public String rowCode;
    public Long count;
    public Double avg;


    @Override
    public ArrayList<TColumnInfo> getColumnInfo() {
        return COLUMN_INFO;
    }

    @Override
    public Vector<Object> castToVector(int index, SimpleRow data) {
        Vector<Object> res = new Vector<>();
        res.add(data.row);
        res.add(data.group);
        res.add(data.rowCode);
        res.add(data.count);
        res.add(data.avg);
        return res;
    }
}
